#!/usr/bin/python

import sys
import dbus

def print_usage():
	print "Usage: %s <service> <target service>" % (sys.argv[0])


if (len(sys.argv) < 2):
	print_usage()
	sys.exit(1)

bus = dbus.SystemBus()
path = "/net/connman/service/" + sys.argv[1]
service = dbus.Interface(bus.get_object('net.connman', path),
					'net.connman.Service')

path2 = "/net/connman/service/" + sys.argv[2]
service2 = dbus.Interface(bus.get_object('net.connman', path2),
					'net.connman.Service')

print "Moving %s before %s" % (sys.argv[1], sys.argv[2])

service.MoveBefore(service2)

print
